home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Binding / BindngH.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  8.1 KB  |  249 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        BindngH.h
  3.  
  4.     Contains:    Class definition for Binding helper object
  5.  
  6.     Owned by:    Caia Grisar 
  7.  
  8.     Copyright:    © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <4>     6/27/96    RA        1343748: Added fSelf to BindingH.h so
  13.                                     Binding can call back to ODBinding
  14.          <3>     6/21/96    RA        1360591: Changed viewer NS type from object
  15.                                     to value
  16.          <2>      1/8/96    CG        1299331 1.0.1: Substitution warning dlg
  17.                                     nolonger displayed in background.
  18.          <5>     8/30/95    CG        #1244563 FB1:Missing editor needs
  19.                                     explanatory alert
  20.                                     #1215054 FB: Too many substitute editor
  21.                                     dialogs
  22.          <4>     6/16/95    CC        1259719: Added ChangeEditor and
  23.                                     ChangeKindAndEditor.
  24.          <3>     5/18/95    CG        #1249263 BB: BndNSUtl.cpp does not compile
  25.                                     standalone.
  26.          <2>     4/27/95    CC        1243813: Removed ShowAlert and
  27.                                     BindingDialogFilter; replaced by ShowAlert
  28.                                     in DlogUtil.
  29.          <1>     4/13/95    CG        first checked in
  30.          <8>    12/13/94    CG        #1193522: Added Binding Alert.
  31.          <7>     8/24/94    CG        #1181622: Updated ownership info.
  32.          <6>     8/17/94    CG        #1181440: ViewNameSpace now return
  33.                                     ODObjectNameSpace.  Made methods
  34.                                     nonvirtual.
  35.          <5>     7/29/94    CG        NameSpace API changes.
  36.          <4>     7/26/94    jpa        Don't inherit from ODObject.
  37.          <3>     6/27/94    CG        Moved IsEditorLoaded here from Prefs,
  38.                                     Removed fEv
  39.          <2>     6/23/94    eeh        remove EditorSet and ODEditorSetIterator
  40.          <1>     6/15/94    CG        first checked in
  41.          <1>      6/1/94    CG        first checked in
  42.         <14>     5/27/94    CG        #1165186: Abstracted out preferences from
  43.                                     Binding object.
  44.         <13>     4/13/94    TÇ        #1147222: Fix the View As popup in the Part
  45.                                     Frame Info dialog.  Also fix the Category
  46.                                     text, and the Kind & Editor popups to show
  47.                                     the current kind & editor respectively.
  48.                                     Made one method public for PtFrInfo.cpp to
  49.                                     use.
  50.         <12>      4/4/94    CC        GetKindsSupported() and
  51.                                     GetCategoriesOfKind() return ODTypeList
  52.                                     (1153046).
  53.         <11>     3/26/94    NP        1152831. Move private functions here.
  54.         <10>     3/23/94    CG        Added VerifyPrefFileVersion() and
  55.                                     UpdatePrefFileVersion() private methods.
  56.          <9>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  57.                                     #1150864.
  58.          <8>     3/14/94    CC        Added GetCurrentEditorForPart() (#1150376);
  59.                                     Made EditorSupportsKind() and
  60.                                     GetKindsSupported() public for
  61.                                     LinkDlgs.cpp.
  62.          <7>     3/11/94    CG        Bug # 1150204 - NMAPs are now loaded
  63.                                     whenever mod date of registered library
  64.                                     folder changes.
  65.          <6>     2/17/94    eeh        bug #1143340: made various private methods
  66.                                     public (to call from EdPrfInf.cpp)
  67.          <5>      2/3/94    CG        Added fHeap field.
  68.          <4>     1/12/94    CG        Removed ODCategorySet.
  69.          <3>    12/16/93    TÇ        moved typedef of ODEditor to PlfmType.h
  70.          <2>    12/10/93    CG        Added ASLM class id definition for the
  71.                                     ODBinding object.
  72.          <1>     11/7/93    TÇ        first checked in
  73.     To Do:
  74. */
  75.  
  76. #ifndef _BINDNGH_
  77. #define _BINDNGH_
  78.  
  79. #ifndef _PLFMDEF_
  80. #include "PlfmDef.h"
  81. #endif
  82.  
  83. #ifndef _ODOBJ_
  84. #include "ODObject.xh"
  85. #endif
  86.  
  87. #ifndef _ODTYPES_
  88. #include "ODTypes.h"
  89. #endif
  90.  
  91. //=====================================================================================
  92. // Theory of Operation
  93. //=====================================================================================
  94.  
  95. /*
  96.     This file describes the ODBinding class. 
  97.     ODBinding is a system service that is used to bind part data to part editors.
  98.     ODBinding also includes a number of utility functions, including mapping content
  99.     kinds to categories, providing a list of part editors supporting a given kind, and 
  100.     routines to access and set system-wide editor preferences.
  101. */
  102.  
  103.  
  104. //=====================================================================================
  105. // Classes defined in this interface
  106. //=====================================================================================
  107. class Binding;
  108.  
  109. //=====================================================================================
  110. // Classes used by this interface
  111. //=====================================================================================
  112. class ODStorageUnit;
  113. class ODDraft;
  114. class ODTypeList;
  115. class ODSession;
  116. class ODObjectNameSpace;
  117. class ODNameSpaceManager;
  118. class ODValueNameSpace;
  119. class OrderedCollection;
  120. class OrderedCollectionIterator;
  121. class ODFile;
  122. class EditorSet;
  123. class ODPart;
  124. class ODBinding;
  125.  
  126. //==============================================================================
  127. // function prototypes
  128. //==============================================================================
  129.  
  130. #ifdef __cplusplus
  131. extern "C" {
  132. #endif
  133.  
  134. #pragma lib_export on
  135.  
  136. ODBoolean     IsNoPart(Environment* ev, ODPart* rootPart);
  137. ODEditor     GetCurrentEditorForPart(ODPart* part );
  138. void        ChangeEditor(ODPart* part, ODEditor editorID); 
  139. void        ChangeKindAndEditor (Environment *ev,
  140.                 ODPart* part,
  141.                 ODType newKind,
  142.                 ODEditor newEditor,
  143.                 ODNameSpaceManager* nsm);
  144.  
  145. #pragma lib_export off
  146.  
  147. #ifdef __cplusplus
  148. }
  149. #endif
  150.  
  151. //=====================================================================================
  152. // Class Binding
  153. //=====================================================================================
  154.  
  155. class Binding
  156. {
  157. public:
  158.     
  159.     Binding();
  160.     
  161.         // ODSession creates one instance of Binding
  162.         // which is then shared among clients within the process.
  163.         
  164.     ODVMethod ~Binding();
  165.     
  166.     ODNVMethod void InitBinding(ODSession* session);
  167.                   
  168.     ODNVMethod ODSize Purge(ODSize size);
  169.     
  170.     //---------------------------------
  171.     // Direct editor bindings
  172.  
  173.     ODNVMethod ODEditor ChooseEditorForPart(ODStorageUnit* thePartSU, ODType newKind );
  174.         // Returns the "best" available editor for the part
  175.         // may invoke automatic translation
  176.  
  177.     ODNVMethod ODEditor TranslateAndChooseEditorForPart(ODStorageUnit* thePartSU);
  178.         // attempt to intelligently translate one of the kinds in the part into 
  179.         // a kind which an available editor supports, and return that editor
  180.  
  181.     //---------------------------------
  182.     // Editor related utility methods
  183.  
  184.     ODNVMethod ODTypeList* GetKindsSupported(ODEditor editor);
  185.         // Returns the set of data types supported (without translation) by the
  186.         // argument editor.
  187.  
  188.     ODNVMethod ODContainerSuite GetContainerSuite(ODContainerType containerType);
  189.     
  190.     ODNVMethod ODBoolean EditorExists(ODEditor editor);
  191.         // Returns true if the argument editor is present on this machine.
  192.         
  193.     ODNVMethod ODBoolean    IsEditorLoaded(ODEditor editor);
  194. private:
  195.  
  196.     ODNVMethod ODEditor ChooseDirectEditorForPart(ODStorageUnit* thePartSU, ODType newKind );
  197.         // Returns the "best" available editor for the part
  198.         // without translation.
  199.     
  200.     ODNVMethod ODEditor ChooseDirectEditorForKind(ODType aKind, ODStorageUnit* thePartSU);
  201.         // Returns the "best" available editor which supports kind aKind of the part
  202.         // without translation.
  203.  
  204.     //---------------------------------
  205.     // Editor related utility methods
  206.  
  207.     ODNVMethod ODEditor GetPreferredEditorForPart(ODStorageUnit* thePartSU, ODBoolean* noPrefEditor);
  208.         // Returns the editor that last externalized the argument storage unit.
  209.         // Null is returned if that editor is not present on the current machine.
  210.         // noPrefEditor is set to true if no kODPropPreferredEditor property exists in the SU
  211.  
  212.     ODNVMethod ODEditor AlphaNumChooseEditor(EditorSet* editorSet);
  213.         // Returns the (alphanum preferred editor over viewer) from 
  214.         // the set of Editors
  215.         
  216.     ODNVMethod ODEditor AlphaNumChooseAnEditorFromTwo(ODEditor e1, ODEditor e2);
  217.         // Returns the (alphanum preferred editor over viewer) of the two editors
  218.         
  219.     ODNVMethod ODBoolean DraftRestrictsEditors(ODDraft* draft);
  220.         // Returns true if the argument draft restricts the editors that may be
  221.         // used in this document.
  222.  
  223.     ODNVMethod EditorSet* GetAllRestrictedEditorsForKind(ODDraft* draft, ODType kind);
  224.         // returns subset of restricted editors of draft which support kind.
  225.         
  226.     //---------------------------------
  227.     // Category and kind mappings
  228.  
  229.     ODNVMethod ODValueNameSpace*        ViewerNameSpace();
  230.  
  231.     //---------------------------------
  232.     // Alert Utilities
  233.     ODNVMethod void SubstitutionWarning(ODEditor theEditor, ODStorageUnit* thePartSU);
  234.  
  235.     ODNVMethod ODBoolean NotifiedSubstitutions(ODEditor theEditor, 
  236.                                                             ODISOStr theCategory);
  237.     
  238.  
  239. // Fields:
  240.  
  241.     ODSession*             fSession;
  242.     ODValueNameSpace*    fSubstitutionList;
  243.     NMUPP                fNMResponseUPP;
  244.     NMRecPtr            fNMRecPtr;
  245.     ODBinding*            fSelf;
  246. };
  247.  
  248.  
  249. #endif // _BINDNGH_